window.listKey = 'SysRunList';
window.run={
    add(obj, callback) {
        //获取
        local.get(listKey).then((list) => {
            if (list && list.length > 0) {
                if (list.filter(e => e.id === obj.id).length > 0) {
                    list.filter(e => e.id === obj.id)[0] = obj;
                } else {
                    list.push(obj);
                }
            }
            list = [obj];
            local.set(listKey, list);
            callback && callback();
        });
    },
    remove(id, callback) {
        local.get(listKey).then((list) => {
            list.forEach((e, i) => {
                if (e.id === id) {
                    list[i] = null;
                }
            });
            local.set(listKey,list.filter(x=>x));
            callback && callback();
        });
    },
    get(id, callback) {
        local.get(listKey).then((list) => {
            callback && callback(list.filter(e => e.id === id));
        });
    },
};